# _*_ coding:utf-8 _*_
"""
description:unittest主方法
"""

import unittest

from common import Driver_Configure, Database
from common.Log import LOG
from common.Driver_Configure import driver_configure


class MyTest(unittest.TestCase):
    """
    自定义MyTest类
    """

    def save_img(self, img_name):
        """错误截图方法"""
        LOG.error("用例执行错误，进行截图。。。")
        self.driver.get_screenshot_as_file(img_name)

    @classmethod  # 不需要实例化类，调用如：类名.setUpClass()
    def setUpClass(cls):
        cls.driver = driver_configure().get_driver()
        LOG.info("测试用例开始执行。。。")

    @classmethod
    def tearDownClass(cls):
        LOG.info("测试用例执行完毕，测试环境正在还原！")
        driver_configure().get_driver().quit()
        Database.cursor.close()  # 关闭游标


if __name__ == '__main__':
    unittest.main()
